#include "Ogre7zPlugin.h"

#include <OgreRoot.h>

namespace Ogre
{

//-------------------------------------------------------------------------------------------------------------------------------------------------
Arcive7zPlugin* g7zPlugin = NULL;
//-------------------------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------------------------
extern "C" void _OgrePlugin7zExport dllStartPlugin(void)
{
	assert( !g7zPlugin && "Application bug, dllStartPlugin is called twice" );

	// Create new plugin
	g7zPlugin = OGRE_NEW_T( Arcive7zPlugin, MEMCATEGORY_GENERAL )();

	// Register plugin instance
	Root::getSingleton().installPlugin( g7zPlugin );
}

//-------------------------------------------------------------------------------------------------------------------------------------------------
extern "C" void _OgrePlugin7zExport dllStopPlugin(void)
{
	assert( g7zPlugin && "Application bug, dllStopPlugin: Plugin not initialised" );

	// Remove plugin instance
	Root::getSingleton().uninstallPlugin( g7zPlugin );

	// Destroy plugin instance
	OGRE_DELETE_T( g7zPlugin, Arcive7zPlugin, MEMCATEGORY_GENERAL );
	g7zPlugin = NULL;

}

} // end of namespace Ogre
